﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link rel="stylesheet" type="text/css" href="{$Think.const.HOME_CSS_URL}formui.css" />
    <link rel="stylesheet" type="text/css" href="{$Think.const.HOME_CSS_URL}admin-all.css" />
    <link rel="stylesheet" type="text/css" href="{$Think.const.HOME_CSS_URL}base.css"/>
    <script type="text/javascript" src="{$Think.const.HOME_JS_URL}jquery-1.7.2.js"></script>
    <script type="text/javascript" src="{$Think.const.HOME_JS_URL}jquery-ui-1.8.22.custom.min.js"></script>
    <link rel="stylesheet" type="text/css" href="{$Think.const.HOME_CSS_URL}ui-lightness/jquery-ui-1.8.22.custom.css" />    
    <script type="text/javascript" src="{$Think.const.HOME_JS_URL}jquery.ui.datepicker-zh-CN.js"></script>
    <script type="text/javascript" src="{$Think.const.HOME_JS_URL}jquery-ui-timepicker-addon.js"></script>
    <script type="text/javascript" src="{$Think.const.HOME_JS_URL}jquery-ui-timepicker-zh-CN.js"></script>
    <script type="text/javascript" src="{$Think.const.HOME_JS_URL}Validform_v5.3.2_min.js"></script>
    <style type="text/css">
        .auto-style1 {
            height: 26px;
        }
    </style>
    
    
</head>
<body>
    <div class="alert alert-info">当前位置<b class="tip"></b>开发计划管理<b class="tip"></b>制定开发计划</div>
        
        <table class="tb" id="top" cellspacing="1" cellpadding="3" width="100%">
            <tr>
                <td class="alert alert-info">机会来源</td>
                <td >{$data['chance_from']}</td>
                <td class="alert alert-info">客户名称</td>
                <td>{$data['client_name']} </td>
                <td class="alert alert-info">成功几率</td>
                <td>{$data['ok_probable']}</td>
                <td class="alert alert-info">概要</td>
                <td>{$data['outline']}</td>
            </tr>
            <tr>
                <td class="alert alert-info">联系人</td>
                <td>{$data['contact_name']}</td>
                <td class="alert alert-info">联系人电话</td>
                <td>{$data['contact_phone']}</td>
                <td class="alert alert-info">机会描述</td>
                <td>{$data['description']}</td>
                <td class="alert alert-info">创建人名称</td>
                <td>{$data['create_name']}</td>
            </tr>
            <tr>
                <td class="alert alert-info">创建时间</td>
                <td>{$data['create_time']|date=\"Y-m-d H:i:s\",###}</td>
                <td class="alert alert-info">指派给</td>
                <td>{$data['give_name']}</td>
                <td class="alert alert-info">指派时间</td>
                <td>{$data['give_time']|date=\"Y-m-d H:i:s\",###}</td>
            </tr>
        </table>
    &nbsp;<a class="btn" id="Button3" href="{:U('lst',array('p'=>$p))}">返回开发计划列表</a>
    <if condition ="$data['status']=='1'">
        &nbsp;<a class="btn" id="Button3" href="{:U('add',array('id'=>$data['id'],'p'=>$p))}">制定开发计划</a>
    &nbsp;<a class="btn" id="Button3" href="{:U('goOpen',array('id'=>$data['id'],'p'=>$p))}">执行开发计划</a>
    <form name="main_form" method="POST" action="{:U('toGood',array('id'=>$data['id'],'p'=>$p))}">
        <input type="hidden" name="sale_id" value="{$data['id']}"/> 
        <input type="hidden" name="name" value="{$data['client_name']}"/> 
        <input type="hidden" name="mname" value="{$name}"/> 
        <input type="hidden" name="p" value="{$p}"/> 
        &nbsp;<input type="submit" class="btn" id="Button3" onclick="return confirm('确定开发成功吗？');" value=" 开发计划成功 " />
    </form>
    &nbsp;<a class="btn" id="Button3" href="{:U('stop',array('id'=>$data['id'],'p'=>$p))}" onclick="return confirm('确定终止开发吗？');" title="终止开发">开发计划失败</a>
    <br/><br/>
    <div  class="alert alert-info">已有的计划项</div>
    
            <volist name="uodata" id="v">
            <form class="demoform"  name="main_form" method="POST" action="{:U('edit')}" enctype="multipart/form-data">
                <table class="tb" id="top" cellspacing="1" cellpadding="3" width="100%">
             <input type="hidden" name="sc_id" value="{$data['id']}"/>
             <input type="hidden" name="p" value="{$p}"/> 
            <tr>
                <td class="alert alert-info">日期</td>
                <input type="hidden" name="time" value="{$v['time']}"/>
                <input type="hidden" name="id" value="{$v['id']}"/>
                <input type="hidden" name="gid" value="{$data['id']}"/>
                <td >{$v['time']|date=\"Y-m-d H:i:s\",###}</td>
                <td class="alert alert-info">计划项</td>
                <td><input size="50" type="text"  name="plan" value="{$v.plan}" datatype="*1-100" errormsg="计划项最多100个字符！"/></td>
                <td><input type="submit" class="Buttons" id="Buttonb" value=" 保存 " />
                <input type="button" class="Buttond"  value=" 删除 " onclick=""/>
                </td>
                       
                </tr>
              </table>
               </form>
            
             </volist>
<div id='have' class="alert alert-info">新添加的计划项</div>
    <br/>
    <div class="alert alert-info">新建计划项</div>
    <form class="demoform"  id="new_form" method="POST" action="__SELF__" enctype="multipart/form-data">
        <input type="hidden" name="sc_id" value="{$data['id']}"/> 
        <input type="hidden" name="p" value="{$p}"/> 
        <table class="tb" id="top" cellspacing="1" cellpadding="3" width="100%">
            <tr>
                <td class="alert alert-info">日期</td>
                <td><input type="text"  name="time" value="{$nowtime}" datatype="*1-100" errormsg="时间必须填写！"/><span style="color:red">*</span></td>
                <td class="alert alert-info">计划项</td>
                <td><input size="50" type="text"  name="plan" value="" datatype="*1-100" errormsg="计划项最多100个字符！"/><span style="color:red">*</span></td>
                <td><input type="button" class="btn" id="comment_btn"  value=" 保存 " /></td>
            </tr>
        </table>
        <br/>
        <br/>
    </form>
    </if>
</body>
</html>
<script>
$( "input[name='time']" ).datetimepicker();
</script>

<script>
    $(".demoform").Validform();
</script>
<script>
    
    
    //添加开发计划
    $("#comment_btn").click(function(){
        // 收集表单中的所有的数据
        var formData = $("#new_form").serialize();
        $.ajax({
            type : "POST",
            url : "/index.php/Home/UserOpen/ajaxAdd",
            data : formData,  // 表单中的数据
            dataType : "text",
            success : function(msg)
            {
                $("#have").after(msg);
                document.getElementById("new_form").reset();
            }});
    });
    
    //删除开发计划
    $(".Buttond").click(function(){
        // 收集表单中的所有的数据
        var formData = $(this).parent().parent().parent().parent().parent().serialize();
        var form = $(this).parent().parent().parent().parent().parent();
        //alert(formData);
        $.ajax({
            type : "POST",
            url : "/index.php/Home/UserOpen/ajaxDelete",
            data : formData,  // 表单中的数据
            dataType : "text",
            success : function(msg)
            {
               if(msg==1){
               form.remove();
                }else{
                    alert('删除失败!');
                }
            }});
    });
    
   
    
</script>
